home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / logiso.000 / logiso / Utils / search_cd < prev   
Encoding:
Korn shell script  |  1995-03-24  |  1.0 KB  |  42 lines

  1. #! /bin/ksh
  2. USAGE='USAGE: search_cd cd_links
  3.    cd_links is a file with file_path 2 tabs and a link value.
  4.    listing all the link files on the CD and the link value.
  5.  
  6.    Find out how we can get to
  7.    /mnt/system_cd/usr/packages/interviews/bin
  8.    through a link.  Look for a link to a file below bin or to 
  9.    bin itself.
  10. '
  11. # (C) Copyright 1995 by Michael Coulter.  All rights reserved.
  12.  
  13. # SEARCH_DIR='/mnt/system_cd/usr/packages'
  14. #SEARCH_DIR='/mnt/system_cd/usr/lib/smail'
  15. #SEARCH_DIR='/mnt/system_cd/usr/X11R6/lib/X11'
  16. SEARCH_DIR='/system_cd/usr/lib/emacs'
  17.  
  18. # Process parameters
  19.  
  20.    CD_LINK="$1" ; shift
  21.  
  22. # Do it
  23.  
  24.   set -P # print absolut hw path
  25.   cat "$CD_LINK" | while read FILE LINK REST
  26.   do
  27.      # echo "search_cd: $FILE $LINK"
  28.      if [ -d "$FILE" ]
  29.      then
  30.         cd "$FILE"
  31.      else
  32.         cd $(dirname "$FILE")
  33.         cd $(dirname "$LINK") 2> /dev/null
  34.      fi
  35.      # echo "search_cd: dir is $PWD"
  36.      if [ "$PWD" != "${PWD#$SEARCH_DIR}" ]
  37.      then
  38.     echo "$FILE with link $LINK is a problem"
  39.      fi
  40.   done
  41.   exit 0
  42.